<template>
  <div>
    <el-table
      :data="tableData"
      ref="tableData"
      stripe
      style="width: 100%"
      :header-cell-style="{ 'background-color': '#D9D9D9' }"
    >
        <el-table-column prop="order_num" label="预约号" width="180" align="center"></el-table-column>
        <el-table-column prop="order_date" label="预约日期" width="180" align="center"></el-table-column>
        <el-table-column prop="ampm" label="时间段" align="center"></el-table-column>
        <el-table-column prop="deptName" label="网点" align="center"></el-table-column>
        <el-table-column prop="public_num" label="业务数量" align="center"></el-table-column>
        <el-table-column prop="control" label="操作" align="center">
            <template slot-scope="scope">
                <el-button type="primary" @click="funs(scope.row)">查看</el-button>
            </template>
        </el-table-column>
    </el-table>
    <div class='location'>
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNum"
        :page-sizes="[10, 15, 20, 25]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageLength"
    ></el-pagination>
    </div>
  </div>
</template>

<script>
import subscribewinVue from './subscribewin.vue';
export default {
    data(){
        return{
            tableData: [],
            pageSize: 10,
            pageNum: 1,
            pageLength: 0,
        }
    },
    methods:{
        requestData(){
            this.$http.get("trademark/order/findByUser",{
                params:{
                    pageNum: this.pageNum,
                    pageSize: this.pageSize,
                }
            }).then((res) => {
                console.log(res);
                this.tableData = res.data.data.data
                this.pageLength = res.data.data.total
            })
        },
        //分页
        handleSizeChange(val) {
        this.pageSize = val;
        this.requestData();
        },
        handleCurrentChange(val) {
        this.pageNum = val;
        this.requestData();
        },
        funs(row){
            console.log(row)
            if(row.public_num == 1){
                this.jumpTo(row);
                return;
            }
            this.$router.push({
                path: "/business/myBusiness/subscribewin",
                query: {ids: row.order_id},
            })
        },
        // 查看详情路由跳转
        jumpTo(item) {
        for (let i = 1; i <= 25; i++) {
            if (i == item.classId) {
            item.classId == 23
                ? (this.path = "/mybussinessForm" + 24)
                : (this.path = "/mybussinessForm" + i);
            }
        }
        this.$router.push({
            path: "/business/myBusiness" + this.path,
            query: { id: item.id },
        });
        },
    },
    mounted(){
        this.requestData();
    }
}
</script>
<style lang="less" scoped>
.location {
 display: flex;
 justify-content:center;
 margin-top:20px
}
</style>
